package eteam.aps.systeminterface.service;

import eteam.aps.common.QueryResult;
import eteam.aps.common.R;
import eteam.aps.common.exceptions.AuthException;
import eteam.aps.systeminterface.model.dto.UserDto;
import eteam.aps.systeminterface.model.entity.OnlineUserEntity;
import eteam.aps.systeminterface.model.entity.UserEntity;
import eteam.aps.systeminterface.model.reqparam.*;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Update;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * 用户服务
 */
public interface IUserController {
    /**
     * 分页查询用户列表
     *
     * @param requestDto: 查询参数
     * @return
     */
    @GetMapping(value = "/api/user/querypagelist")
    R<QueryResult<UserEntity>> queryUserPageList(@Validated QueryUserParam requestDto) throws Exception, AuthException;

    /**
     * 新增用户
     *
     * @param userDto: 用户信息
     * @return
     */
    @PostMapping(value = "/api/user/createuser")
    R createUser(@Validated(Insert.class) @RequestBody UserDto userDto) throws Exception, AuthException;

    /**
     * 更新用户
     *
     * @param userDto: 用户信息
     * @return
     */
    @PostMapping(value = "/api/user/updateuser")
    R updateUser(@Validated(Update.class) @RequestBody UserDto userDto) throws Exception, AuthException;

    /**
     * 删除用户
     *
     * @param userParam: 用户Id参数
     * @return
     */
    @PostMapping(value = "/api/user/deleteuser")
    R deleteUser(@Validated @RequestBody IdParam userParam) throws Exception, AuthException;

    /**
     * 变更状态，启用/禁用
     *
     * @param changeParam: 变更状态参数
     * @return
     */
    @PostMapping(value = "/api/user/changeuserstate")
    R changeUserState(@Validated @RequestBody ChangeStateParam changeParam) throws Exception, AuthException;

    /**
     * 分页查询在线用户
     *
     * @param requestDto
     * @return
     */
    @GetMapping(value = "/api/user/queryonlineuserpagelist")
    R<QueryResult<OnlineUserEntity>> queryOnlineUserPageList(@Validated QueryOnlineUserParam requestDto) throws Exception, AuthException;

    /**
     * 删除在线用户，下线
     *
     * @param idParam
     * @return
     */
    @PostMapping(value = "/api/user/deleteonlineuserbyid")
    R deleteOnlineUserById(@Validated @RequestBody IdParam idParam) throws Exception, AuthException;

    /**
     * 批量删除在线用户，下线
     *
     * @param idsParam
     * @return
     */
    @PostMapping(value = "/api/user/deleteonlineuserbyids")
    R deleteOnlineUserByIds(@Validated @RequestBody IdsParam idsParam) throws Exception, AuthException;

    /**
     * 重置密码
     *
     * @param resetPwdParam
     * @return
     */
    @PostMapping(value = "/api/user/resetuserpwd")
    R resetUserPwd(@Validated @RequestBody ResetPwdParam resetPwdParam) throws Exception, AuthException;

    /**
     * 修改个人密码
     *
     * @param modifyPwdParam
     * @return
     */
    @PostMapping(value = "/api/user/modifyselfpwd")
    R modifySelfPwd(@Validated @RequestBody ModifySelfPwdParam modifyPwdParam) throws Exception, AuthException;

    /**
     * 修改个人密码
     *
     * @param findPwdParam
     * @return
     */
    @PostMapping(value = "/api/user/findselfpwd")
    R findSelPwd(@Validated @RequestBody FindPwdParam findPwdParam) throws Exception;
}
